<template>
	<div class="model">
		<h2 class="model__title">
			退换货详情
			<span @click="close" class="model__title--close">&times;</span>
		</h2>
		<div class="model__content" v-loading="loading">
			<div v-if="data">
				<div class="item" v-if="data.aggainst_reason">
					<h2 class="item__title item__title-warning">驳回理由</h2>
					<div class="item__reason">
						{{data.aggainst_reason}}
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">货物详情</h2>
					<div v-for="item in data.commodities">
						<div class="item__detail item__detail-block">
							<span class="item__detail--title ">商品名:&nbsp;</span>
							<img :src="item.mainimg.url" class="item__detail--pic" />
							<span class="item__detail--value">{{item.commodity_name}}</span>
						</div>
						<br/>
						<div class="item__detail">
							<span class="item__detail--title">商品数量:&nbsp;</span>
							<span class="item__detail--value">{{item.commodity_num}}件</span>
						</div>
						<br/>
						<div class="item__detail">
							<span class="item__detail--title">商品库存:&nbsp;</span>
							<span class="item__detail--value">{{item.stocks}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">是否为点分商品:&nbsp;</span>
							<span v-if="item.is_fen" class="item__detail--value">是</span>
							<span v-else class="item__detail--value">否</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">是否邮寄:&nbsp;</span>
							<span v-if="item.is_post" class="item__detail--value">是</span>
							<span v-else class="item__detail--value">否</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">是否线上销售:&nbsp;</span>
							<span v-if="item.is_online" class="item__detail--value">是</span>
							<span v-else class="item__detail--value">否</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">好评率:&nbsp;</span>
							<span class="item__detail--value">{{item.good_comment_rate}}%</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">卖价:&nbsp;</span>
							<span class="item__detail--value">{{item.sale_price}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">上架时间:&nbsp;</span>
							<span class="item__detail--value">{{item.onshief_time | formatTime}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">商品评分:&nbsp;</span>
							<span class="item__detail--value">{{item.comment_score}}分</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">评论数:&nbsp;</span>
							<span class="item__detail--value">{{item.comment_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">收藏数:&nbsp;</span>
							<span class="item__detail--value">{{item.collection_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">浏览次数:&nbsp;</span>
							<span class="item__detail--value">{{item.see_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">分享次数:&nbsp;</span>
							<span class="item__detail--value">{{item.share_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">销售次数:&nbsp;</span>
							<span class="item__detail--value">{{item.sale_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">商品编号:&nbsp;</span>
							<span class="item__detail--value">{{item.commodity_no}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">商品总销量:&nbsp;</span>
							<span class="item__detail--value">{{item.total_sale_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">点币:&nbsp;</span>
							<span class="item__detail--value">{{item.dian_bi}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">点币价格:&nbsp;</span>
							<span class="item__detail--value">{{item.bi_price}}</span>
						</div>
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">退换货理由</h2>
					<div class="item__detail item__detail-block">
						<span class="item__detail--title">原因:&nbsp;</span>
						<el-tag>{{data.reason.reason_name}}</el-tag>
					</div>
					<div class="item__detail item__detail-block">
						<span class="item__detail--title">描述:&nbsp;</span>
						<span class="item__detail--value">{{data.remarks}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">图片说明:&nbsp;</span>
						<div class="item__pic" v-if="data.return_img">
							<img :src="item.url" v-for="item in data.return_img"/>
						</div>
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">收货人与地址</h2>
					<div class="item__detail">
						<span class="item__detail--title">详细地址:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.address.address}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">收货人姓名:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.address.person}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">收货人手机号:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.address.mobile}}</span>
					</div>					
				</div>
				<div class="item">
					<h2 class="item__title">退货用户</h2>
					<div class="item__detail">
						<span class="item__detail--title">用户昵称:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.nick_name}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">用户身份:&nbsp;&nbsp;</span>
						<span class="item__detail--value">
							<el-tag v-if="data.member.is_saleman">推广大使</el-tag>
							<el-tag v-if="data.member.is_manager">区域经理</el-tag>
							<el-tag v-if="data.member.is_company_manager">推广商家</el-tag>
							<el-tag 
								type="info"
								v-if="!data.member.is_saleman&&!data.member.is_manager&&!data.member.is_company_manager"
								>普通用户</el-tag>
						</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">真实姓名:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.real_name}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">用户手机号码:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.mobile}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">连续签到天数:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.continue_signin_days}}</span>
					</div>

					<div class="item__detail">
						<span class="item__detail--title">用户注册时间:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.regist_time}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">用户邮箱:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.email}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">用户成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.grow_value}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">线上现金成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.on_cash_grow}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">线下现金成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.off_cash_grow}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">线上点元成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.on_yuan_grow}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">线下点元成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.off_yuan_grow}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">线上点分成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.on_fen_grow}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">消费频率成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.rf_grow}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">消费激励成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.cost_grow}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">活跃成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.member.login_grow}}</span>
					</div>	
				</div>
				<div class="item">
					<h2 class="item__title">发货仓库</h2>
					<div class="item__detail">
						<span class="item__detail--title">仓库名称:&nbsp;&nbsp;</span>
						<span class="item__detail--value">
							<el-tag>{{data.warehouse.warehouse_name}}</el-tag>
						</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">仓库地址:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.warehouse.address}}</span>
					</div>	
					<div class="item__detail">
						<span class="item__detail--title">联系人:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.warehouse.linkman}}</span>
					</div>	
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		props: ["id"],
		data() {
			return {
				data: null,
				loading: true
			}
		},
		created() {
			this.fetchReturnGetDetail();
		},
		methods: {
			close() {
				this.$parent.showModel = false;
			},
			fetchReturnGetDetail() {
				this.loading = true;
				var url = `${this.url}/order/return_get_info_man.action`;
				var params = {
					return_info_id: this.id
				};
				this.$http.get(url,{ params }).then((res)=> {
					this.loading = false;
					this.data = res.data.result;
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	
</style>